using Cysharp.Threading.Tasks;
using QFramework;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InitGameConfigState : AbstractState<LaunchState, Launch>, IController
{
    public InitGameConfigState(FSM<LaunchState> fsm, Launch target): base(fsm, target)
    {
    }
    public override void OnEnter()
    {
        this.SendCommand<InitGamePoolsCommand>();
        this.GetSystem<IWmsSystem>().InitializeCargo(() =>
        {
            InitConfigInfo();
            ChangeState();
        });
    }

    private void InitConfigInfo()
    {
        this.SendCommand<LoadConfigCommand>();
        this.SendCommand<LoadWmsShelfCommand>();
    }

    private void ChangeState()
    {
        mFSM.ChangeState(LaunchState.EnterGame);
    }

    public IArchitecture GetArchitecture()
    {
        return DigitalTwin_GeLinMei_2.Interface;
    }
}
